import axios from 'axios';
// import type { RouteRecordNormalized } from 'vue-router';
import { UserState } from '@/store/modules/user/types';

export interface LoginData {
    userName: string;
    password: string;
}

export interface LoginRes {
    token: string;
}
export function login(data: LoginData) {
    return axios.post<LoginRes>('/api/v1/login', data);
}

export function logout() {
    return axios.post<LoginRes>('/api/v1/logout');
}

export function getUserInfo() {
    return axios.post<UserState>('/api/v1/user/current');
}

export function getMenuList() {
    return axios.post('/api/v1/menu/list');
}

export function getPermissionCode() {
    return axios.post('/api/v1/permission/list');
}
